package org.example.webaiproject05.Mapper;

import org.apache.ibatis.annotations.*;
import org.example.webaiproject05.pojo.Emp;
import org.example.webaiproject05.pojo.EmpQueryParam;

import java.util.List;

/**
员工表
 */
@Mapper
public interface EmpMapper {
//    @Select("select count(*)from emp e left join dept d on e.dept_id = d.id;")
//    public Long count();
//    @Select("select e.*,d.name deptName from emp e left join dept d on e.dept_id = d.id order by e.update_time desc limit #{start},#{pageSize}")
//    public List<Emp> list(Integer start, Integer pageSize);
    //使用PageHelper来进行分页查询
    //@Select("select e.*,d.name deptName from emp e left join dept d on e.dept_id = d.id order by e.update_time desc")
//    public List<Emp> list(@Param("name") String name, @Param("gender") Integer gender, @Param("begin")  LocalDate begin, @Param("end") LocalDate end);
    //条件查询员工信息
    public List<Emp> list(EmpQueryParam empQueryParam);
    /*新增员工基本信息*/
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert  into  emp (username, name, gender, phone, job, salary, image, entry_date, dept_id, create_time, update_time)" +
            " VALUES  (#{username},#{name},#{gender},#{phone},#{job},#{salary},#{image},#{entryDate},#{deptId},#{createTime},#{updateTime})")
    void insert(Emp emp);
// 根据ID 来批量删除员工的基本信息 动态sql

    void deleteByIds(List<Integer> ids);
//根据id查询员工的信息以及查询工作经历的信息
    Emp getById(Integer id);

    void updateById(Emp emp);
}
